Comparing Changes using Complete Compare

You can compare your model with database, script, or another local model to check for differences using the Complete Compare wizard. Based on the results, you can then resolve or merge differences. Thus, maintaining a consistent model and database.

This topic walks you through the steps to compare a MongoDB model with database. Similarly, you can compare your Cassandra and Couchbase models.

To compare models with database:

  1. Open your MongoDB model in erwin Data Modeler (DM).

    Note: Ensure that you are in the Physical mode.

    For example, the following image uses a MongoDB model with two collections.

  2. Click Actions > Complete Compare.
    By default, the Complete Compare wizard assigns the open model as the Left Model. Hence, the Right Model section appears.

  3. Click Database/Script.
    By default, the Allow Demand Loading option is selected.

  4. Click Load.
    The New Model dialog box appears. This starts the reverse engineering process to pull a model from the database to compare.

  5. Ensure that the Database is set to the correct one. In this case, MongoDB. Then, click Next.
    The Reverse Engineer Process Wizard appears.

  6. Click Database. Then, click Next.
    The Connection section appears. Use this section to connect to the database from which you want to reverse engineer the model.

  7. After connection is established, click Next.
    The Database section appears. It displays a list of available databases.

  8. Under Available Databases, select the databases that you want to reverse engineer. Then, click .
    This moves the selected databases under Selected Databases.

  9. Click Next and in the Collection section, click .
    This selects all the available collections. Also, ensure that the Document Count/Document % is not set to zero (0).

  10. Click Next and in the Option Set section, keep the default configuration.

  11. Click Next and in the Detail Options section, keep the default configuration.

  12. Click OK.
    The reverse engineering process starts. Once the process is complete, the Right Model is set to the one that you reverse engineered.

  13. Click Next and in the Type Selection section, select the appropriate options.

    For example, the following image shows the default options.

  14. Click Next and in the Left Object Selection section, select the appropriate options.

    For example, the following image shows the default options.

  15. Click Next and in the Right Object Selection section, select the appropriate options.

    For example, the following image shows the default options.

  16. Click Compare.
    The comparison process runs, and the Resolve Differences dialog box appears. It displays the differences between your model and database.
    For example, the following image shows that the Rating collection is available in your model but not in the database.

    Select the Rating collection and click . This will move the Rating collection to the right model (from the database). Similarly, resolve other differences.

  17. As differences were moved to the right model, click .
    This launches the Forward Engineering Alter Script Generation Wizard.

  18. Click Option Selection and clear all the Drop check boxes.

  19. Click Collection Filter and select or verify the collections to be included on the forward engineering script.

  20. Click Preview to view and verify the alter script.

  21. Click Generate and connect to your MongoDB database.
    The forward engineering process starts. The script generates your physical database schema. You can access your database and verify the newly generated schema.

  22. Click OK. Then click Finish.
    This closes the Resolve Differences dialog box and displays the Complete Compare wizard.

  23. Click Close.